<%inherit file="base.html"/>

<%def name="head()">
<script>
    function deletePortal(portal_id)
    {
        if(confirm("确认删除吗？"))
        {
            window.location.href = "/portal/delete?portal_id="+portal_id;
        }
    }

</script>
</%def>

<%def name="body()">
<section class="content">
    <div class="box box-primary">
        <div class="box-header">
            <i class="fa fa-sitemap"></i>
            <h3 class="box-title">Portal节点列表</h3>
        </div>
        <div class="box-body">
            <div class="container">

                <table class="table table-hover">
                    <thead>
                    <tr>
                        <th>Portal名称</th>
                        <th>Portal地址</th>
                        <th>共享密钥</th>
                        <th>管理端口</th>
                        <th>认证端口</th>
                        <th>监听端口</th>
                        <th>AC地址</th>
                        <th>状态</th>
                        <th>最后检测</th>
                    </tr>
                    </thead>
                    <tbody>
                    % for item in portal_list:
                    <tr>
                        <td>${item.name}</td>
                        <td>${item.ip_addr}</td>
                        <td>${item.secret}</td>
                        <td>${item.admin_port}</td>
                        <td>${item.http_port}</td>
                        <td>${item.listen_port}</td>
                        <td>${item.ac_server}</td>
                        <td>${portal_status[item.status]}</td>
                        <td>${item.last_check}</td>
                        </td>
                        <td>
                            % if permit.match(current_user.username,'/portal/delete'):
                            <a class="opt-btn btn-default" href="javascript:deletePortal('${item.id}')">删除</a>
                            % endif
                        </td>
                    </tr>
                    % endfor
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</section>
</%def>